import  request  from "@/utils/request.js";


/* 获取图片验证码code */
export const getCodeApi = (phone) => {
    return request(`/user/sms_register/${phone}`)
}


/* 注册 */

export const registerUserApi = (data) => {
    return request('/user/register', {
        method: "POST",
        data
    })
}

/*  登录 */
export const loginApi = (data) => {
   return request("/user/login", {
        method:"POST", 
        data
    })
}

/* 修改用户信息 */

 export const modifyUserInfoAPI = (data) =>  {
    return request('/user/updateHeadAndName',{
        method:"PUT",
        data
    })
} 

/* 上传用户头像 */

export const uploadUserHaderApi =(data) => {
    return request('/file/upload',{
        method:"POST",
        data,
        headers: {
            'Content-Type': 'multipart/form-data',
        },
        timeout: -1
    })
}


/* 修改用户头像 */

export const modifyUserHaderApi = data => {
    return request('/user/updateHeadAndName',{
        method: "PUT",
        data
    })
}

/* 修改密码 */

export const modifyPasswordAPI = (data) => {

    return request('/user/updatePassword',{
        method: "PUT",
        data
    })
}
